package com.itheima.HomeWork;

import java.util.Scanner;

public class HM02 {
    public static void main(String[] args) {
        String name = "user";
        String password = "123456";
        Scanner sc = new Scanner(System.in);
        for(int i = 1;i<=3;i++){
            System.out.println("请输入你的用户名");
            String username = sc.nextLine();
            System.out.println("请输入你的密码");
            String scpassword = sc.nextLine();
            if (name.equals(username) && password.equals(scpassword)) {
                System.out.println("登陆成功");
                break;
            } else {
                if (i == 3) {
                    System.out.println("您的次数已用完，请明天再来");
                } else {
                    System.out.println("您还剩余" + (3 - i) + "次机会");
                }

            }
        }
    }


}
